package com.afteryuan.engine.service.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.afteryuan.engine.model.Scene;
import com.afteryuan.engine.model.SceneData;
import com.afteryuan.engine.service.SceneDataService;
import com.afteryuan.dao.HibernateEntityDao;
import com.afteryuan.util.PaginationBean;

public class SceneDataServiceImpl extends HibernateEntityDao<SceneData> implements SceneDataService {

	private static Log log = LogFactory.getLog(SceneDataServiceImpl.class);
	


	public List<SceneData> list(String sceneid, Object... values) {
		String hql="from SceneData where scene.id='"+sceneid+"'";
        List<SceneData> cds = null;
		if(values.length>0&&values[0] instanceof PaginationBean)
			cds = createList(hql,values[0]);
		else
			cds = createList(hql);
        return cds;
	}

    public List<SceneData> list(Scene scene, Object... values) {
        return list(scene.getId(),values);
    }

    public void removed(Scene scene) {
		String hql="delete from SceneData where scene=?";
        createQuery(hql,scene).executeUpdate();
	}


}
